<template>
  <div class="ChildPage TablePage" v-loading="loading">
    <vb-page ref="page">
<!--      <template #table-handle-prepend="scope">-->
<!--        <el-button size="mini" type="text" icon="el-icon-edit" @click="gotoDetail(scope.row.billNo)">查看</el-button>-->
<!--      </template>-->
<!--      <template #table-stockNo="scope">-->
<!--        {{ getStockName(scope.row.stockNo) }}-->
<!--      </template>-->
<!--      <template #table-count="scope">-->
<!--        {{ scope.row.count? Number(scope.row.count.toFixed(6)): scope.row.count }}-->
<!--      </template>-->
<!--      <template #table-status="scope">-->
<!--        <el-tag :type="scope.row.status === 'save'? 'info': 'success'">{{ scope.row.status === 'save'? '保存': '审核' }}</el-tag>-->
<!--      </template>-->
    </vb-page>
  </div>
</template>

<script>
export default {
  data() {
    return {
      materialLoading: false,
      reloadMaterial: false,
    }
  },
  async mounted() {
    await this.getStock()
  },
  methods: {
    async getStock() {
      this.loading = true;
      try {
        let res = await this.$api.getChildDictionaryListByKeys({
          keys: ['stock']
        });
        if (!res.res) return;
        this.stockList = res.stock;
      } finally {
        this.loading = false;
      }
    },
    /**
     * 获取状态名
     */
    getStockName(val) {
      if (this.stockList && this.stockList.length > 0) {
        for(let i = 0; i < this.stockList.length; i++) {
          if (this.stockList[i].key === val) {
            return this.stockList[i].name;
          }
        }
      }
      return '';
    },
    gotoDetail(billNo = '') {
      let url = '/produce/materialBomInDetail'
      if (billNo) {
        url += `?billNo=${ billNo }`
      }
      this.$router.push(url)
    }
  }
}
</script>

<style scoped>

</style>
